#ifndef CS270_FA2016_GAMEBOARD
#define CS270_FA2016_GAMEBOARD

#include <vector>

namespace CS270Game {
//A game with a 2-Dimensional board
template<class Token>
class GameBoard {

  //Returns an integer number for which player has won, 
  // or -1 if no player has won given the current board state
 public:
  virtual int isWin() = 0; 

  //Allows us to treat the board itself as if it were a 2D array
  std::vector<Token>& operator[](int i) { return theBoard[i]; }

  int numRows() { return nrows; }
  int numCols() { return ncols; }

  //Checkes for contiguous sequences of a particular value
  //Returns true if there is a line of tokens equal to "val"
  // at least "length" long.  Checks horizontal, vertical, and 
  // diagonal lines.
  bool findLines(Token val, int length);
 
  //Since this is a 2D board game, we can declare the board 
  //here as a vector, with the size to be determined by a subclass
 protected:
  GameBoard(int rows, int cols, Token init) : 
    nrows(rows), ncols(cols), 
    theBoard(rows, std::vector<Token>(cols, init)) {};

  int nrows, ncols;
  std::vector< std::vector<Token> > theBoard;
};

}
#endif // CS270_FA2016_GAMEBOARD
